﻿package idv.cjcat.monica.platformer.player {
	import flash.display.DisplayObjectContainer;
	import flash.display.MovieClip;
	import flash.display.Sprite;
	import idv.cjcat.monica.Ref;
	import idv.cjcat.rusher.geom.Vec2D;
	import idv.cjcat.rusher.rendering2d.RenderTargetComponent;
	
	public class PlayerRenderTarget extends RenderTargetComponent {
		
		public static const SCALE:Number = 0.11;
		private var _direction:Number = SCALE;
		public function set direction(value:Number):void {
			if (value > 0) _direction = SCALE;
			else if (value < 0) _direction = -SCALE;
		}
		public function get direction():Number {
			if (_direction > 0) return 1;
			else if (_direction < 0) return -1;
			else return 0;
		}
		
		public function get scale():Vec2D { return new Vec2D(_direction, SCALE); }
		
		internal var container	:DisplayObjectContainer;
		
		internal var standing	:MovieClip;
		internal var walking	:MovieClip;
		internal var moving		:MovieClip;
		internal var running	:MovieClip;
		internal var stopping	:MovieClip;
		
		internal var walling	:MovieClip;
		
		internal var jumpingUpVertical	:MovieClip;
		internal var jumpingUpForward	:MovieClip;
		internal var jumpingUpRoll		:MovieClip;
		internal var wallRebound		:MovieClip;
		
		internal var fallingDown:MovieClip;
		internal var fallingDownRoll:MovieClip;
		
		internal var landing:MovieClip;
		
		internal var die:MovieClip;
		
		public function PlayerRenderTarget() {
			container = new Sprite();
			displayObject = container;
			
			standing = new MonicaStanding();
			walking = new MonicaWalking();
			moving = new MonicaMoving();
			running = new MonicaRunning();
			stopping = new MonicaStopping();
			
			standing.gotoAndStop(1);
			walking.gotoAndStop(1);
			moving.gotoAndStop(1);
			running.gotoAndStop(1);
			stopping.gotoAndStop(1);
			
			jumpingUpVertical = new MonicaJumpingUpVertical();
			jumpingUpForward = new MonicaJumpingUpForward();
			jumpingUpRoll = new MonicaJumpingUpRoll();
			wallRebound = new MonicaWallRebound();
			
			jumpingUpVertical.gotoAndStop(1);
			jumpingUpForward.gotoAndStop(1);
			jumpingUpRoll.gotoAndStop(1);
			wallRebound.gotoAndStop(1);
			
			walling = new MonicaWalling();
			
			walling.gotoAndStop(1);
			
			fallingDown = new MonicaFallingDown();
			fallingDownRoll = new MonicaFallingDownRoll();
			
			fallingDown.gotoAndStop(1);
			fallingDownRoll.gotoAndStop(1);
			
			landing = new MonicaLanding();
			landing.gotoAndStop(1);
			
			die = new MonicaDie();
			die.gotoAndStop(1);
		}
	}
}